import java.lang.*;
public class Complex {
    //定义属性并生成getter，setter
    double RealPart;
    double ImagePart;
    public double getRealPart() {
        return RealPart;
    }
    public void setRealPart(double realPart) {
        this.RealPart=realPart;
    }
    public double getImagePart() {
        return ImagePart;
    }
    public void setImagePart(double imagePart) {
        this.ImagePart=imagePart;
    }
    //定义构造函数
    public Complex(double R, double I) {
        RealPart = R;
        ImagePart = I;
    }
    //Override Object
    public boolean equals(Complex obj1) {
        if (this.getRealPart () == obj1.getRealPart () && this.getImagePart () == obj1.getImagePart ())
            return true;
        else return false;
    }
    //定义公有方法：加减乘除
    public String toString() {
        return "第一个"+RealPart + " 第二个" + ImagePart ;
    }
    public Complex ComplexAdd(Complex obj) {
        return new Complex ( RealPart + obj.getRealPart (), ImagePart + obj.getImagePart () );
    }
    public Complex ComplexSub(Complex obj) {
        return new Complex ( RealPart - obj.getRealPart (), ImagePart - obj.getImagePart () );
    }
    public Complex ComplexMulti(Complex obj) {
        return new Complex ( RealPart * obj.getRealPart () - ImagePart * obj.getImagePart (), RealPart * obj.getImagePart () + ImagePart * obj.getRealPart () );
    }
    public Complex ComplexDiv(Complex obj){
        return new Complex ( RealPart / obj.getRealPart () - ImagePart / obj.getImagePart (), RealPart / obj.getImagePart () + ImagePart / obj.getRealPart () );
    }
}